﻿using System;
using System.Diagnostics;
using System.Globalization;
using System.Threading;
using System.Windows.Forms;
using DevExpress.LookAndFeel;
using DevExpress.Skins;
using DevExpress.UserSkins;
using NNS.Framework;
using QLTB.Capnhat.Entity;

namespace QLTB
{
    internal static class Program
    {
        public static bool _exit;
        public static double Version = 1.4;

        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        private static void Main()
        {
            //FtpClient ftp=new FtpClient("10.81.30.111","huyen","huyen");
            //ftp.CurrentDirectory = @"/VP_BDT/HoangTam/QLTB/Update";
            //long t= ftp.GetFileSize("Update.exe");
            //ftp.Download("Update.exe", "d:\\update.exe", true);
            var ds = new dsUpdate();
            ds.UPDATE.AddUPDATERow("410fd78b-6b21-4769-8d62-7c8f56bdcb67", "Quản lý thiết bị", Version.ToString(),
                                   Version.ToString(), 0, Process.GetCurrentProcess().ProcessName, 0,
                                   "Standard", Application.StartupPath);

            ds.KillProcess.AddKillProcessRow("QLTB.exe");

            ds.WriteXml(Application.StartupPath + "\\Update.sys");

            var cultureInfo = new CultureInfo("vi-VN");
            cultureInfo.NumberFormat.NumberDecimalDigits = 2;
            cultureInfo.NumberFormat.NumberDecimalSeparator = ".";
            cultureInfo.NumberFormat.NumberGroupSeparator = ",";

            Thread.CurrentThread.CurrentCulture = cultureInfo;

            DbHelper.ConnectionString = @"Data Source=.;Initial Catalog=QLTHIETBI;Integrated Security=True";
            _exit = false;
            BonusSkins.Register();
            OfficeSkins.Register();
            SkinManager.EnableFormSkins();
            UserLookAndFeel.Default.SkinName = "Office 2007 Blue";
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new frmMain());
        }
    }
}